package com.swy.resource;

import org.springframework.http.ResponseEntity;
import org.springframework.security.core.userdetails.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;


@RestController
public class UserController {
    //资源API
    @GetMapping("/userinfo")
    public ResponseEntity<User> getUserInfo(Principal principal) {
        User user = (User) principal;
        return ResponseEntity.ok(user);
    }
}